package com.riche.codefactory.model.s2c;

import com.riche.codefactory.model.domain.QuestionBankQuestion;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 题库题目关联视图
 *
 */
@Data
public class S2cQuestionBankQuestion implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 题库 id
     */
    private Long questionBankId;

    /**
     * 题目 id
     */
    private Long questionId;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 创建用户信息
     */
    private S2cUser user;

    /**
     * 封装类转对象
     *
     * @param s2cQuestionBankQuestion
     * @return
     */
    public static QuestionBankQuestion voToObj(S2cQuestionBankQuestion s2cQuestionBankQuestion) {
        if (s2cQuestionBankQuestion == null) {
            return null;
        }
        QuestionBankQuestion questionBankQuestion = new QuestionBankQuestion();
        BeanUtils.copyProperties(s2cQuestionBankQuestion, questionBankQuestion);
        return questionBankQuestion;
    }

    /**
     * 对象转封装类
     *
     * @param questionBankQuestion
     * @return
     */
    public static S2cQuestionBankQuestion objToVo(QuestionBankQuestion questionBankQuestion) {
        if (questionBankQuestion == null) {
            return null;
        }
        S2cQuestionBankQuestion s2cQuestionBankQuestion = new S2cQuestionBankQuestion();
        BeanUtils.copyProperties(questionBankQuestion, s2cQuestionBankQuestion);
        return s2cQuestionBankQuestion;
    }
}
